/****************************************************************************
 * @file    FileManager.h
 * @brief   A file management module for FloraModule.
 * @details This module provides functions to check file existence,
 *          create files and directories, query system disk space, and open
 *          file dialogs for selecting files and directories.
 *
 * @author  繁花遁
 * @date    2024-08-30
 ****************************************************************************/

#ifndef FILEMANAGER_H
#define FILEMANAGER_H

#include <QString>
#include <QDir>
#include <QFile>
#include <QFileDialog>
#include <QStorageInfo>
#include <QWidget>

// Check if a file exists
bool fileExists(const QString& filePath);

// Ensure a file exists by creating it and its directories if needed
bool ensureFileExists(const QString& filePath);

// Query system disk space
qint64 getFreeDiskSpace(const QString& path);

// Open a file dialog for selecting files or directories
QString openFileDialog(QWidget* parent, const QString& caption, const QString& filter, bool saveMode = false);

void removeOldFilesIfOverSizeLimit(const QString& dirPath, qint64 maxSizeMB);
void moveJpgFiles(const QString& sourcePath, const QString& destinationPath) ;
#endif // FILEMANAGER_H
